package function

import sun.security.util.Password

trait Ball {
  def describe(): String = "ball"


}
trait ColorBall extends Ball{
  val color:String="red"
  override def describe(): String = color+"-"+super.describe()
  def colorOfSelect():Unit
}
class CategoryBall extends Ball{
  var category:String="foot"

  override def describe(): String = category+"-"+super.describe()
}
class MyFootBall extends CategoryBall with ColorBall with Ball {
  override def describe(): String = "my ball is a "+super.describe()

  override def colorOfSelect(): Unit = println("抽象方法实现")
}
//自身类可以实现依赖注入的功能
class User(val name:String,val password:Password)
object Balled {
  def main(args: Array[String]): Unit = {
    val ball = new MyFootBall()
    val str: String = ball.describe()

    println(str+"\n"+ball.colorOfSelect())

  }
}
